﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPageSERIX.Master" AutoEventWireup="true"
    CodeBehind="ProgramacaoMunicipios.aspx.cs" Inherits="SERIX.ProgramacaoMunicipios" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table width="97%" border="0" cellspacing="0" cellpadding="2" align="center">
        <tr>
            <td class="secao_titulo" style="width: 284px">
                Programação - Atendimento por Municipio<hr class="linhaHorizontal" style="width: 740px" />
            </td>
        </tr>
    </table>
    <asp:UpdatePanel ID="UpdatePanelFiltro" runat="server">
        <ContentTemplate>
            <asp:Panel runat="server" ID="pnlProgramacaoMunicipio">
                <table border="0" cellpadding="2" cellspacing="0" width="97%">
                    <tr>
                        <td class="grid_titulo" style="text-align: left">
                            <label>
                                <span style="color: #FFFFFF">Ano:</span>
                                <br />
                                <asp:DropDownList ID="ddlAno" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlAno_SelectedIndexChanged">
                                </asp:DropDownList>
                            </label>
                        </td>
                    </tr>
                </table>
                <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" CssClass="grid"
                    OnRowDataBound="gridView_RowDataBound" EmptyDataText="Nenhum registro encontrado."
                    DataKeyNames="idt_mun,idt_pms,valor_pms,idt_pps" 
                    DataSourceID="odsProgramas">
                    <AlternatingRowStyle CssClass="row_alter" />
                    <Columns>
                        <asp:BoundField DataField="nome_mun" HeaderText="Municipio" ItemStyle-Width="320px">
                            <HeaderStyle Width="200px" />
                            <ItemStyle Width="320px"></ItemStyle>
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Beneficiario sem Repetição">
                            <ItemTemplate>
                                <asp:TextBox ID="tbxValor" runat="server" Text='<%# Bind("Valor_PMS") %>'></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Programas">
                            <ItemTemplate>
                                <asp:Button ID="btnProgramas" runat="server" Text="Programas" OnClick="btnProgramas_Click" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle CssClass="emptyrow" />
                    <FooterStyle CssClass="footer" />
                    <HeaderStyle CssClass="header" />
                    <PagerStyle CssClass="pager" />
                    <RowStyle CssClass="row" />
                </asp:GridView>
                <div style="text-align: right">
                    <asp:Button ID="btnConfirmar" runat="server" Font-Bold="True" Text="Confirmar" Width="78px"
                        OnClick="btnConfirmar_Click" />
                    <br />
                    <asp:Label ID="lblmsg" runat="server" CssClass="label_verde" TabIndex="-1" Visible="False"
                        Width="740px"></asp:Label>
                </div>
                <asp:ObjectDataSource ID="odsProgramas" runat="server" OnSelecting="odsProgramas_Selecting"
                    SelectMethod="ObterProgramacaoMunicipio" TypeName="SERIX.Classes.CProgramacao"
                    OldValuesParameterFormatString="original_{0}">
                    <SelectParameters>
                        <asp:ControlParameter ControlID="ddlAno" Name="ANO_PMS" PropertyName="SelectedValue"
                            Type="String" />
                        <asp:Parameter Name="IDT_TEC" Type="String" />
                        <asp:Parameter Name="login" Type="String" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </asp:Panel>
            <br />
            <asp:Panel runat="server" ID="pnlProgramacaoPrograma" Visible="False">
                <asp:GridView ID="gridViewProgramas" runat="server" AutoGenerateColumns="False" CssClass="grid"
                    DataKeyNames="idt_pms,valor_pms,idt_prog" DataSourceID="odsProgramasValor" 
                    EmptyDataText="Nenhum registro encontrado.">
                    <AlternatingRowStyle CssClass="row_alter" />
                    <Columns>
                        <asp:BoundField DataField="nom_Prog" HeaderText="Programa" ItemStyle-Width="320px">
                            <HeaderStyle Width="200px" />
                            <ItemStyle Width="320px" />
                        </asp:BoundField>
                        <asp:TemplateField HeaderText="Valor">
                            <ItemTemplate>
                                <asp:TextBox ID="tbxValor" runat="server" Text='<%# Bind("qtd_pps") %>'></asp:TextBox>
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataRowStyle CssClass="emptyrow" />
                    <FooterStyle CssClass="footer" />
                    <HeaderStyle CssClass="header" />
                    <PagerStyle CssClass="pager" />
                    <RowStyle CssClass="row" />
                </asp:GridView>
                <div style="text-align: right">
                    <asp:Button runat="server" Text="Confirmar" ID="btnConfirmarProgramas" OnClick="btnConfirmarProgramas_Click" />
                    <asp:Button ID="btnCancelar" runat="server" Font-Bold="True" Text="Cancelar" 
                        Width="78px" onclick="btnCancelar_Click" />
                    <br />
                    <asp:Label ID="lblmsgProgramas" runat="server" CssClass="label_verde" TabIndex="-1"
                        Visible="False" Width="740px"></asp:Label>
                </div>
            </asp:Panel>
            <br />
            <asp:ObjectDataSource ID="odsProgramasValor" runat="server" OldValuesParameterFormatString="original_{0}"
                OnSelecting="odsProgramasValor_Selecting" SelectMethod="ObterProgramacaoPrograma"
                TypeName="SERIX.Classes.CProgramacao">
                <SelectParameters>
                    <asp:Parameter Name="idt_pms" Type="String" />
                    <asp:Parameter Name="login" Type="String" />
                </SelectParameters>
            </asp:ObjectDataSource>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
